package com.ruoyi.user.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.user.domain.Regions;
import com.ruoyi.user.mapper.RegionsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.user.mapper.AnswerMapper;
import com.ruoyi.user.domain.Answer;
import com.ruoyi.user.service.IAnswerService;

/**
 * 回答列表Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-11
 */
@Service
public class AnswerServiceImpl implements IAnswerService 
{
    @Autowired
    private AnswerMapper answerMapper;

    @Autowired
    private RegionsMapper regionsMapper;
    /**
     * 查询回答列表
     * 
     * @param id 回答列表主键
     * @return 回答列表
     */
    @Override
    public Answer selectAnswerById(Integer id)
    {
        return answerMapper.selectAnswerById(id);
    }

    /**
     * 查询回答列表列表
     * 
     * @param answer 回答列表
     * @return 回答列表
     */
    @Override
    public List<Answer> selectAnswerList(Answer answer)
    {
        return answerMapper.selectAnswerList(answer);
    }

    /**
     * 新增回答列表
     * 
     * @param answer 回答列表
     * @return 结果
     */
    @Override
    public int insertAnswer(Answer answer)
    {
        answer.setCreateTime(DateUtils.getNowDate());
        return answerMapper.insertAnswer(answer);
    }

    /**
     * 修改回答列表
     * 
     * @param answer 回答列表
     * @return 结果
     */
    @Override
    public int updateAnswer(Answer answer)
    {
        return answerMapper.updateAnswer(answer);
    }

    /**
     * 批量删除回答列表
     * 
     * @param ids 需要删除的回答列表主键
     * @return 结果
     */
    @Override
    public int deleteAnswerByIds(Integer[] ids)
    {
        return answerMapper.deleteAnswerByIds(ids);
    }

    /**
     * 删除回答列表信息
     * 
     * @param id 回答列表主键
     * @return 结果
     */
    @Override
    public int deleteAnswerById(Integer id)
    {
        return answerMapper.deleteAnswerById(id);
    }

    @Override
    public List<Regions> getRegions() {
        List<Regions> regions = regionsMapper.getRegions();
        return regions;
    }
}
